Compression of visual data is important because raw visual data such as images and video typically require a large number of bits for their representation. Compression allows for storage and transmission of visual data using a smaller number of bits. One aspect of compression relates to removing redundancy in the visual data, for example, by generating prediction residuals representing a difference between an original frame or block and a prediction of that original frame or block. Another aspect of compression relates to the energy compaction property associated with the processing of visual data using a transform. In transform-based coding of visual data, a transform is applied to a portion of the visual data (e.g., a block of data from a frame or prediction residual), resulting in transform coefficients. With a proper choice of the transform, a large amount of energy can be preserved with a small number of large transform coefficients. This is known as the energy compaction property of transforms. A better energy compaction allows visual data to be encoded with fewer coefficients, while preserving a certain level of image quality. Various encoding steps are also typically applied to the transform coefficients.